<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>组织类型信息设置管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			getCheckList=function(){
				var ids = [];
					$("input[name='ids']:checked").each(function(){
						ids.push($(this).val());
					});
				return ids;
			}
			$("#checkAll").on('click', function() {
				var ch = this.checked;  //复选框
				if(ch){
					$("input[name='ids']").prop("checked", true);
				}else{
					$("input[name='ids']").prop("checked", false);
				}
			});
			$("#addBtn").on('click', function() {
				window.location.href="${ctx}/partysinfo/partysInfo/form";
			});
			$("#deleBtn").on('click', function() {
				var ids =getCheckList();
				if(ids.length<1){
					alert("请选择一条记录进行删除");
					return false;
				}
				window.location.href="${ctx}/partysinfo/partysInfo/delete?id="+ids[0].split('|')[0];
			});
			$("#updateBtn").on('click', function() {
				var ids =getCheckList();
				if(ids.length!=1){
					alert("请选择一条记录进行修改");
					return false;
				}
				window.location.href="${ctx}/partysinfo/partysInfo/form?id="+ids[0].split('|')[0];
			});
		
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/partysinfo/partysInfo/">组织类型信息设置列表</a></li>
	</ul>
	<form:form id="searchForm" modelAttribute="partysInfo" action="${ctx}/partysinfo/partysInfo/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<input type="hidden" name="ids" id="ids"/> 
		<ul class="ul-form">
			<li><label>党组织名称：</label> 
			<form:input path="organizationName" htmlEscape="false" maxlength="150" class="input-medium"/>
			</li>
			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询">
			<shiro:hasPermission name="partysinfo:partysInfo:edit">
			<input id="addBtn" class="btn btn-primary" type="button" value="新增"/>
			<input id="updateBtn" class="btn btn-primary" type="button" value="修改"/>
			<!-- <input id="deleBtn" class="btn btn-primary" type="button" value="删除"/> -->
			</shiro:hasPermission>
			</li>
			<li class="clearfix"></li>
		</ul>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
			<th width="5%" style='text-align:center'><input type="checkBox" id="checkAll"/></th>
				<th>党组织信息名称</th>
				<th>党组织类型</th>
				<th>状态</th>
				<shiro:hasPermission name="partysinfo:partysInfo:edit"><th>操作</th></shiro:hasPermission>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="partysInfo">
			<tr>
			<td style='text-align:center'><input type='checkbox' name='ids' value='${partysInfo.id}'/></td>
				<td style='text-align:center'><a href="${ctx}/partysinfo/partysInfo/peizhi?id=${partysInfo.id}">
					${partysInfo.organizationName}
				</a></td>
				<td style='text-align:center'>
					${partysInfo.partyType.name}
				</td>
				<td style='text-align:center'>
					${fns:getDictLabel(partysInfo.state, 'Start_Stop', '')}
				</td>
				<shiro:hasPermission name="partysinfo:partysInfo:edit"><td style='text-align:center'>
    				<c:if test="${partysInfo.state==1}">
					<a href="${ctx}/partysinfo/partysInfo/updateStop?id=${partysInfo.id}" 
					onclick="return confirmx('确认要关闭该党组织类型吗？', this.href)">关闭</a></c:if>
					<c:if test="${partysInfo.state==2}">
					<a href="${ctx}/partysinfo/partysInfo/updateStart?id=${partysInfo.id}" 
					onclick="return confirmx('确认要启动该党组织类型吗？', this.href)">启动</a></c:if>
				</td></shiro:hasPermission>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>